﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _20_Strategy
{
    internal class Demo1
    {

    }
    public class Context
    {
        private Strategy _strategy;
        public Context(Strategy strategy)
        {
            _strategy = strategy;
        }
        public string ExecuteStrategy(int score)
        {
            return _strategy.Check(score);
        }
    }
    public interface Strategy
    {
        string Check(int score);
    }
    public class StrategyImp01:Strategy 
    {
        public string Check(int score)
        {
            var result = "";
            if (score<60)
            {
                result = "差";
            }
            return result;
        }
    }
    public class StrategyImp02 : Strategy
    {
        public string Check(int score)
        {
            var result = "";
            if (score<70 && score>=60)
            {
                result = "良";
            }
            return result;
        }
    }
    public class StrategyImp03 : Strategy
    {
        public string Check(int score)
        {
            var result = "";
            if (score<80 && score>=70)
            {
                result = "中";
            }
            return result;
        }
    }
    public class StrategyImp04 : Strategy
    {
        public string Check(int score)
        {
            var result = "";
            if (score>=80)
            {
                result = "优";
            }
            return result;
        }
    }
}
